#ifndef UTILS_H
#define UTILS_H

#include <stdint.h>

#define MAX_TARGET          100
#define MIN_TARGET          0

#define BOUND_GAPX          1
#define BOUND_GAPY          1
#define ZERO_MARK_WIDTH     5

#define CURVE_SX            30
#define CURVE_SY            45
#define CURVE_WIDTH         180
#define CURVE_HEIGHT        80
#define MAX_VALUE_RATIO     0.9f

#define SPEED_CURVE_REDUCTION_FACTOR    2.3         // 定速波形衰减倍数
#define DISTANCE_CURVE_REDUCTION_FACTOR 8.3         // 定距波形衰减倍数

uint8_t IsChinese(const char* str);
uint8_t CharCount(const char* str);
int StrWidth(const char* str);
void LCD_ShowStringV2(uint16_t x, uint16_t y, const char *p, uint16_t fc, uint16_t bc, uint8_t sizey, uint8_t mode);
int NormalizeY(int value, int maxV);
void DrawBoundingBox(int sx, int sy, int width, int height, uint16_t color);
void DrawZeroMark(int sx, int sy, int width, int height, uint16_t color);
void ClearCurve(int sx, int sy, int width, int height, uint16_t color);
int DrawCurve(int sx, int sy, int width, int height, uint16_t color, uint16_t bgColor, int curveValue);
int DrawDistanceCurve(int sx, int sy, int width, int height, uint16_t color, uint16_t bgColor, int curveValue);
void ResetCurveState();
#endif